#ifndef REFERENCEPROXYMODEL_H
#define REFERENCEPROXYMODEL_H



#include "proxies_global.h"
#include "AbstractTreeProxyModel.h"



class PROXIESSHARED_EXPORT ReferenceProxyModel : public AbstractTreeProxyModel
{
    Q_OBJECT

public:

    enum Field
    {
        Field_FIRST = 0,
        NameField = Field_FIRST,
        Field_LAST = NameField
    };

    ReferenceProxyModel(QObject *parent = 0);

    void setSourceTarget(const QModelIndex& sourceIndex);

    virtual int columnCount(const QModelIndex &parent) const;
    virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;

    virtual QVariant data(const QModelIndex &proxyIndex, int role) const;


protected slots:

    virtual void remap();

    /// \param Proxy model's QModelIndex, which is mapped to source model's index.
    /// \return Source target's reference index, which has the same value as source model's mapped id index.
    virtual QModelIndex mapToSourceReference(const QModelIndex& proxyIndex) const;

    /// \brief Create a reference from source target to source model's index which is mapped to proxy index parameter.
    virtual QModelIndex createReference(const QModelIndex& proxyIndex, const int& type);
    virtual void removeReference(const QModelIndex& proxyIndex);


protected:

    QPersistentModelIndex m_sourceTarget;


};

#endif // REFERENCEPROXYMODEL_H
